package com.smartstate.iot.controller;

import com.smartstate.common.web.httpResult.ApiResultIgnore;
import com.smartstate.iot.service.ResourcesMonitorService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/monitor")
public class ResourcesMonitorController {
    @Autowired
    private ResourcesMonitorService resourcesMonitorService;

    /**
     *  查询网络上下行速度
     * @return
     */
    @GetMapping("/net")
    @ApiResultIgnore
    @ApiOperation(value = "查询网络上下行速度")
    public Map<String, Double> netMonitor(){
        return resourcesMonitorService.netMonitor();
    }

    /**
     *  查询cpu使用情况
     * @return
     */
    @GetMapping("/cpu")
    @ApiResultIgnore
    @ApiOperation(value = "查询cpu使用情况")
    public Integer cpuMonitor(){
        return resourcesMonitorService.cpuMonitor();
    }

    /**
     *  查询内存使用情况
     * @return
     */
    @GetMapping("/memory")
    @ApiResultIgnore
    @ApiOperation(value = "查询内存使用情况")
    public Map<String,Integer> memoryMonitor(){
        return resourcesMonitorService.memoryMonitor();
    }

    /**
     *  查询磁盘读写速率
     * @return
     */
    @GetMapping("/disk")
    @ApiResultIgnore
    @ApiOperation(value = "查询磁盘读写速率")
    public Map<String,Double> diskMonitor(){
        return resourcesMonitorService.diskMonitor();
    }

}
